import request from '@/router/axios';

export const getList = (current,size,task) => {
    return request({
        url: '/api/kettle/task/list',
        method: 'get',
        params: {
          current,
          size,
          ...task
        }
    })
}

export const getDetail = (id) => {
  return request({
    url: `/api/kettle/task/detail`,
    method: 'get',
    params: {
      id
    }
  })
}

export const add = (task) => {
  return request({
    url: '/api/kettle/task/save',
    method: 'post',
    data: task
  })
}

export const update = (task) => {
  return request({
    url: '/api/kettle/task/update',
    method: 'post',
    data: task
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/kettle/task/remove',
    method: 'post',
    params: {
      ids
    }
  })
}

export const removeTempTaskFile = (ids) => {
  return request({
    url: '/api/kettle/fileuploadtemp/remove',
    method: 'post',
    params: {
      ids
    }
  })
}

export const startTask = (id) => {
  return request({
    url: `/api/kettle/task/start/${id}`,
    method: 'get',
  })
}

export const closeTask = (id) => {
  return request({
    url: `/api/kettle/task/close/${id}`,
    method: 'get',
  })
}
